home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_c
/
bc_ti
/
ti652.asc
< prev
next >
Wrap
Text File
|
1992-02-24
|
1KB
|
67 lines
PRODUCT : C++ NUMBER : 652
VERSION : All
OS : PC DOS
DATE : February 25, 1992 PAGE : 1/1
TITLE : Interrupt Handlers as Member Functions
An interrupt handler cannot be made a static member of a
class because there is no way to pass such a function a 'this'
pointer. It is possible, however, to overcome this difficulty by
creating a static member function that is given access to a
pointer to the class that is currently active. For example:
class ISR {
public:
static void interrupt handler();
ISR *active;
void handle();
};
void interrupt ISR::handler() {
active->handle();
}
In this example, ISR::handler() is installed as the handler and
active must be set to point to a valid instance of ISR.